package com.lagou.servlet;

import com.lagou.bean.Student;
import com.lagou.service.StudentSerive;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "SelectStudentServlet", value = "/SelectStudentServlet")
public class SelectStudentServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1.获取相应从参数
        String select = request.getParameter("select");
        //
        StudentSerive studentSerive = new StudentSerive();
        Student student = studentSerive.selectStudent(select);
        if (select!=null){
            request.getSession().setAttribute("student",student);
            response.sendRedirect("find.jsp");
        }
    }
}
